import request from '@/request/index.js'
const base = 'base' //http://101.42.107.47:30020文档

//获取所有的菜单数据
export const getAllMenuList = (data) => {
    return request({
        url: `/api/${base}/api/source/tree`,
        method: 'GET',
    })
}

//新增角色
export const addRole = (data) => {
    return request({
        url: `/api/${base}/api/role`,
        method: 'post',
        data,
    })
}

//获取角色列表
export const getAllRoleList = (params) => {
    return request({
        url: `/api/${base}/api/role/all`,
        method: 'GET',
        params,
    })
}

//删除角色
export const delRole = (id) => {
    return request({
        url: `/api/${base}/api/role/${id}`,
        method: 'DELETE',
    })
}

//获取角色菜单权限
export const getRoleMenuPermission = (params) => {
    return request({
        url: `/api/${base}/api/role/source`,
        method: 'GET',
        params,
    })
}

//修改角色
export const editRole = (data) => {
    return request({
        url: `/api/${base}/api/role`,
        method: 'PUT',
        data,
    })
}

//批量删除
export const batchDelRole = (data) => {
    return request({
        url: `/api/${base}/api/role/batch/delete`,
        method: 'POST',
        data,
    })
}

//批量启用
export const batchStartRole = (data) => {
    return request({
        url: `/api/${base}/api/role/batch/start`,
        method: 'POST',
        data,
    })
}

//批量禁用
export const batchStopRole = (data) => {
    return request({
        url: `/api/${base}/api/role/batch/stop`,
        method: 'POST',
        data,
    })
}

//角色添加用户
export const roleAddUserApi = (data) => {
    return request({
        url: `/api/${base}/api/role/user`,
        method: 'PUT',
        data,
    })
}